package main

import "fmt"

// interface vs extends
func main() {
	var m *LittleMonkey = &LittleMonkey{
		Monkey{Name: "孙悟空"},
	}
	m.climbing() //孙悟空 爬树
	m.FlyAway()  //孙悟空 fei fei fei 。。。。
	m.swimming() //孙悟空 swimming swimming 。。。。

}

type Monkey struct {
	Name string
}

func (m *Monkey) climbing() {
	fmt.Println((*m).Name, "爬树")
}

type LittleMonkey struct {
	Monkey //继承
}

type Fly interface {
	FlyAway()
}
type Swim interface {
	swimming()
}

func (m *LittleMonkey) FlyAway() {
	fmt.Println((*m).Name, "fei fei fei 。。。。")
}

func (m *LittleMonkey) swimming() {
	fmt.Println((*m).Name, "swimming swimming 。。。。")
}
